<section data-ng-controller="RecoverPasswordController">
    <div data-ng-show="passwordReseted">
        <h3>Your password is changed successfully. <a href="/login">Sign in</a> to have a nice time with us.</h3>
    </div>

    <div data-ng-show="invalidToken">
        <h3>{{tokenError}}</h3>
        <hr/>
        <a href="/recovery">Try again</a>
    </div>

    <div data-ng-show="!invalidToken && !passwordReseted">
        <div class="alert alert-danger" ng-show="isError">
            <span ng-bind="error"></span>
        </div>
        <h3>Change password</h3>
        <form name="changePassword" novalidate mi-submit="resetPassword()">
            <div class="form-group" ng-class="{'has-error':(changePassword|shouldDisplayError:changePassword)}">
                <label for="password">New password</label>
                <input type="password" name="password" id="password" placeholder="input password..." class="form-control"
                        ng-model="input.password" required ng-minlength="6"/>
                <span class="help-block" data-ng-show="changePassword.password|shouldDisplayError:changePassword:'required'">
                    Please input your new password
                </span>
                <span class="help-block" data-ng-show="changePassword.password|shouldDisplayError:changePassword:'min'">
                    Your password must have more than 6 characters
                </span>
            </div>
            <div class="form-group" ng-class="{'has-error':(changePassword|shouldDisplayError:changePassword)}">
                <label for="passwordConfirm">Confirm new password</label>
                <input type="password" name="passwordConfirm" id="passwordConfirm" placeholder="input password..." class="form-control"
                        ng-model="input.passwordConfirm" required/>
                <span class="help-block" data-ng-show="changePassword.password|shouldDisplayError:changePassword:'required'">
                    Please confirm your new password
                </span>
                <span class="help-block" ng-show="isMatch() && changePassword.password.$dirty && changePassword.confirmPassword.$dirty">
                    Your password doesn't match
                </span>
            </div>
            <button type="submit" class="btn btn-primary">Save</button>
        </form>
    </div>
</section>
